import threading
import apsw

class connectorite(threading.Thread):
	def __init__(self,connection):
		threading.Thread.__init__(self)
		self.connection = connection

	def run(self):
		cursor = self.connection.cursor()
		cursor.execute("""begin""")
		cursor.execute("""insert into test values ('totozaure')""")
		cursor.execute("""commit""")
		print threading.current_thread(),"executed insert"
		

con = apsw.Connection(":memory:")
cur = con.cursor()
cur.execute("create table if not exists test (test text)")

thread1 = connectorite(con)
thread2 = connectorite(con)
thread3 = connectorite(con)

thread1.start()
thread2.start()
thread3.start()
